/**
 * User: alesj
 * Date: 2005.3.17
 * Time: 18:02:27
 * 
 * (C) Genera Lynx d.o.o.
 */

package com.generalynx.common.components;

import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.BeansException;

import java.text.DateFormat;

public class BeanFactoryAwareComponentFactory implements IComponentFactory, BeanFactoryAware {

    private BeanFactory beanFactory;

    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        this.beanFactory = beanFactory;
    }

    //---------- components --------------

    public DateFormat getDefaultDateFormat() {
        return (DateFormat)beanFactory.getBean("defaultDateFormat");
    }

    public DateFormat getDefaultDateTimeFormat() {
        return (DateFormat)beanFactory.getBean("defaultDateTimeFormat");
    }

    public DateFormat getDefualtDateTimeExactFormat() {
        return (DateFormat)beanFactory.getBean("defaultDateTimeExactFormat");
    }

    public DateFormat getDefaultTimeFormat() {
        return (DateFormat)beanFactory.getBean("defaultTimeFormat");
    }

}
